@import '../../styles/var.less';

.k-tree {
  .k-tree-item {
    padding-bottom: 4px;
    margin: 0;
    list-style: none;
    white-space: nowrap;
    outline: 0;
    user-select: none;
    display: flex;
    align-items: center;
		line-height: 1;
    .k-checkbox {
      margin-right: 4px;
    }
  }

  // .k-tree-children {
  // 	// margin: 0;
  // 	.k-tree-item-children {
  // 		// margin: 0 0 0 24px;
  // 		position: relative;
  // 	}
  // }
  .k-tree-comment {
    display: inline-block;
    width: 24px;
    position: relative;
    height: 24px;
  }

  // .k-checkbox-wp {
  // 	margin: 0;
  // }
  .k-tree-icon {
    margin-right: 5px;
    vertical-align: middle;
    font-size: 14px;
  }

  .k-tree-title {
    display: inline-flex;
    padding: 0 4px;
    align-items: center;
    // margin: 0 4px;
    z-index: 0;
    border-radius: @radius;
    cursor: pointer;
    color: var(--kui-color-font);
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
		min-height: 24px;
    // transition: all .2s ease-in-out;
    &:hover {
      background: var(--kui-color-hover);
      outline: none;
    }
  }

  .k-tree-item-drop {
    >.k-tree-title {
      background-color: var(--kui-color-main) !important;
      color: #fff;
    }
  }

  .k-tree-item-drag {
    >.k-tree-title {
      // background-color: tint(var(--kui-color-main), 90%) !important;
    }
  }

  .k-tree-item-extra {
    flex: 1;
    text-align: right;
    z-index: 1;
    padding-right: 4px;
  }

  .k-tree-item-extra-hidden {
    .k-tree-item-extra {
      display: none;
    }

    &:hover {
      .k-tree-item-extra {
        display: block;
      }
    }
  }

  .k-tree-item-disabled {

    .k-tree-title,
    .k-tree-icon {
      color: var(--kui-color-disable-color);
      cursor: not-allowed;
    }

    .k-tree-title {

      &:hover,
      &:focus {
        background-color: transparent;
      }
    }
  }

  .k-tree-title-selected {
    background: var(--kui-color-selected);

    &:hover {
      background: var(--kui-color-selected);
    }
  }

  .k-tree-arrow {
    font-size: 14px;
    width: 24px;
    height: 24px;
    position: relative;
    // text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    // transform: rotate(90deg);
    // transition: all .2s ease-in-out;
    cursor: pointer;

    // background-color: #fff;
    .k-icon {
      transition: all .2s ease-in-out;
    }
  }

  .k-tree-arrow-open .k-icon {
    transform: rotate(90deg)
  }

  .k-tree-children {
    // overflow: hidden;
    transition: all .2s ease-in-out;
  }

  .tree-nodata {
    padding: 8px 10px;
    display: block;
    color: var(--kui-color-disable-color);
    font-size: 12px;
  }
}

.k-tree-directory {
  position: relative;

  .k-tree-title {

    &:hover,
    &:focus {
      background-color: transparent;
    }
  }

  .k-tree-item {
    cursor: pointer;
    position: relative;
		
    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 24px;
    }
  }

  .k-tree-item:hover::before {
    background-color: var(--kui-color-hover);
  }

  .k-tree-item-selected,
  .k-tree-item-selected:hover {
    &::before {
      color: #fff;
      background-color: var(--kui-color-main);
    }

    .k-tree-title ,.k-icon {
      background-color: transparent;
      color: #fff;
    }
  }

  .k-tree-item-disabled:hover {
    cursor: not-allowed;

    .k-tree-title {
      color: var(--kui-color-disable-color);
    }

    &::before {
      display: none;
    }
  }
}

.k-tree-show-line {
  .k-tree-arrow {
    transform: rotate(90deg);

    .k-icon {
      font-size: 16px;
    }
  }

  .k-tree-item-children {
    position: relative;
  }

  .k-tree-line {
    border-left: 1px solid var(--kui-color-border);
    position: absolute;
    height: 100%;
		z-index: 1;
  }

  .k-tree-comment {
    &::before {
      content: '';
      position: absolute;
      left: 12px;
      top: 0;
      width: 1px;
      height: 28px;
      background-color: var(--kui-color-border);
    }

    &::after {
      content: '';
      position: absolute;
      left: 12px;
      top: 12px;
      width: 12px;
      height: 1px;
      background-color: var(--kui-color-border);
    }
  }


  .k-tree-children:last-child {

    >.k-tree-item>.k-tree-comment::before {
      height: 12px;
    }

    >.k-tree-item-children {
      >.k-tree-line {
        display: none;
      }
    }

  }
}